home *** CD-ROM | disk | FTP | other *** search
- > I have a few questions about Amos Pro:
- >
- > 1) Is there an AGA extension yet?
-
- No, only andy churches intuition extension which works for AGA inuition
- screens. AGA is to central to AMOS to be fixed from an extension - it needs
- an AMOSPro re-write.
-
- > 2) Is there any way to read a two-button joystick from either port?
- >
-
- Everyone always answers this with "Get hold of sticks extension", but no-one
- actually says how to get hold of sticks extension _ I haven't a clue.
-
-
- > And a general question about coding:
- >
- > What is a good procedure for detecting a "tap" of a fire button and a
- > "press" (button held down)? Right now I have something like
- >
- > Procedure TESTHOLDBUTTON[STICK]
- > '
- > ' STICK is the port number
- > '
- > X = TRUE
- > DELAY = 1200 : ' this is arbitrary
- > While X = True
- > X = Fire(STICK)
- > Z = Z + 1
- > If Z > DELAY Then X = False : ' Break out of loop if button held
- > too long
- > Wend
- > If Z < DELAY
- > R = False
- > Else
- > R = True
- > End If
- > End Proc[R]
- > '
- > ' R tells calling procedure whether button was tapped (False) or pressed
- > ' (True).
- > '
- >
- > This procedure works fine except that when I let go of the pressed button,
- > the procedure registers a press AND a tap. I suspect that it's because
- >
- > a) procedure is called
- > b) procedure is exited when "True" is returned, but button is still held
- > c) procedure is called and exited again and again...
- > d) eventually, Z < DELAY after n number of procedure calls
- >
- > Any way to fix this?
- >
-
- PROCEDURE TESTHOLDBUTTON[STICK]
- Shared LAST_TIME,START_TIME
-
- If Fire(STICK)
- If LAST_TIME
- 'Button is still held from previous call
- Pop Proc[-1]
- Else
- If START_TIME=0
- 'Beginning of a new press
- START_TIME=Timer
- Pop Proc[0]
- Else
- 'Button pressed in a previous call, but
- 'timeout for a tap has not expired yet
- If Timer-STARTTIME<2000
- 'Cant decide which it is yet
- Pop Proc[0]
- Else
- 'Decided it is a press
- LAST_TIME=True
- Pop Proc[-1]
- End If
- End If
- End If
- Else
- 'Button not pressed.
- If LAST_TIME
- 'Just released from a press.
- LAST_TIME=False
- START_TIME=0
- Pop Proc[0]
- Else
- If START_TIME
- 'Was a tap
- START_TIME=0
- Pop Proc[1]
- Else
- 'Button Never Pressed at all.
- Pop Proc[0]
- End If
- End If
- End If
- End Proc
-
- This returns:
-
- 0 = Nothing as happend / the fire button is pressed, but not
- enough time has passed to tell if it is a tap or press
- 1 = A tap has occured
- -1 = A press has occured.
-
- It also has that advantage that it doesn't wait in the procedure for
- 2000 50ths of a second, but exits immediately.As long as you call it
- regularly, there won't be a problem, but if you leave it too long
- between calls it might think taps are presses.
-
- Note - I haven't tested this - I don't have an amiga handy.
-
-
- +-------------------------+------------------------------------+
- | | _____ |
- | PAUL HICKMAN | / \ ON A HOT SUMMER NIGHT |
- | (ph@doc.ic.ac.uk) | / O O \ WOULD YOU OFFER YOUR |
- | DEPARTMENT OF COMPUTING | | _ | THROAT TO THE WOLF |
- | IMPERIAL COLLEGE LONDON | \ / \ / WITH THE RED ROSES ? |
- | | \_____/ |
- +-------------------------+------------------------------------+
- Machines: Amiga 500 WB1.3 - 1mb Memory - External Disk Drive.
- Amiga 1200 WB3.0 - 6mb Memory - 200Mb Hard Disk.
-
-
-